import { NativeModules } from 'react-native';
import { isIOS } from '../../constant';

const getTotalRxBytes = (): number => {
  return NativeModules.NetSpeed.getTotalRxBytes();
};

const getUidRxBytes = (uid: number = 0): number => {
  if (isIOS) {
    return NativeModules.NetSpeed.getTotalRxBytes();
  }
  return NativeModules.NetSpeed.getUidRxBytes(uid);
};

const getNetSpeed = (bytes: number, duration: number): number => {
  return NativeModules.NetSpeed.getNetSpeed(bytes, duration);
};

export default {
  getTotalRxBytes,
  getUidRxBytes,
  getNetSpeed
};
